﻿#ifndef HELICOPTER_H
#define HELICOPTER_H

#include <QLabel>
#include<QPixmap>
#include"Infrequent/planemarker.h"
#include<QVector>
#include<QUdpSocket>
#include <QNetworkInterface>
#include<QTextEdit>
#include<QLineEdit>
#include<QPushButton>
#include<QMap>
#include"Infrequent/frienddrone.h"
#include<QSet>
class Helicopter : public QLabel
{
    Q_OBJECT
    Q_PROPERTY(QPoint location READ getLocation WRITE setLocation)
public:
    explicit Helicopter(QWidget* parent = nullptr, QString name = "");
    QPoint getLocation() {
        return location;
    }
    void setLocation(QPoint& location) {
        if (this->location != location) {
               this->location = location;
        }
    }
    QPoint location;
    QPointF temp=QPointF(0,0);
    QPointF translate=QPointF(0,0);
    bool isMarked=false;
    QPixmap pixmap;
    QVector<PlaneMarker*>markerVector;
    bool showRoute=false;
    void generatePlaneMarker();
    QPoint getLocation() const { return location; }
    void setLocation(const QPoint& loc) { location = loc; update(); }
signals:
    void initResponseDrone();
public slots:
    void dealMsg();
    void on_pushButton_find_clicked();
    void on_pushButton_s_clicked();
public:
    QUdpSocket* udpSocket;
    QTextEdit *textEdit;
    QLineEdit*lineEdit;
    QMap<int,FriendDrone*>responseMap;
    QSet<QString>droneIp;
    int droneNumber=0;
};

#endif // HELICOPTER_H
